const fs = require("fs");
const { resolve } = require("path");
const path = resolve(__dirname, "package.json");
const jsonfile = fs.readFileSync(path);

var jsonString = jsonfile.toString();
const jsonValue = JSON.parse(jsonString);
const ph = process.env.NODE_ENV == "dev";
// console.log("ph - ", ph);
jsonValue.main = ph ? "source/index.js" : "src/index.js";
jsonString = JSON.stringify(jsonValue);
fs.writeFileSync(path,jsonString);

// const jsonfile1 = fs.readFileSync(path);
// console.log(jsonfile1.toString());
